<%@ include file = "/common/ini.jsp"%> 
<%@ include file = "/common/_log4j.jsp"%>
<%@ include file = "/common/_ApplicationContext_init.jsp"%>  
<%
    String[] rsr = new String[] {"A","B","C","D","E","F","G","H"};
    ExamQuestionManager examQuestionManager = (ExamQuestionManager)applicationContext.getBean("examQuestionManager");
    ExamQuestion eq = examQuestionManager.getRandomExamQuestionByKnowledgePoint(request.getParameter("kpId"));
    if(eq == null)
    {
        %>
        <div width="100%" align="center"><b>无相关试题。。。</b></div>
        <script>
            $('showRsButton').disabled = true;
        </script>
        <%
        return;
    }
    else
    {
        logger.debug("kpId :" + request.getParameter("kpId") );
        logger.debug("找到题目:" + eq.getId() );
        logger.debug("单选题：" + eq.isSimpleSelect());
        logger.debug("多选题：" + eq.isMultielect());
        logger.debug("主观题：" + eq.isSubjective());
    }
    
    Set<Result> rss = eq.getRandomResults();
%>
<script>     
    $('tryButton').disabled = false;
</script>
<table width="100%" >
    <tr>
        <td><b>【<%= eq.getQuestType().getName()%>】：</b></td>
    </tr>
    <tr>
        <td>&nbsp;&nbsp;&nbsp;&nbsp;<%= eq.getNotNewLineContent()%></td>
    </tr>
    <tr>
        <td><b>【答题】：</b><br></td>
    </tr>
    <%
    // 选择题
    if(!eq.isSubjective())
    {        
        int i = 0;
        for(Result rs : rss)
        {
            %>
            <tr>
                <td width="100%" height="10" id="srtd<%= i%>">
                   <input id="srs<%= i%>" name="srs" type="checkbox" onclick="checkTr(this,<%= rss.size()%>,<%= eq.isSimpleSelect()%>)" value="<%= rs.isRight()%>">&nbsp;【<%= rsr[i]%>】&nbsp;&nbsp; <%= rs.getNotNewLineContent()%><br>
                    
                </td>
            </tr>
            <%
                i++;
        }
    }    
    %>
    <tr id="resolutionTitle" style="display:none">
        <td><b>【解析】：</b></td>
    </tr>
    <tr id="resolutionTr" style="display:none">
        <td>
        <%
        if(!eq.isSubjective())
        {
            int i = 0;
            %><b>正确答案：</b><%
            for(Result rs : rss)
            {
                if(rs.isRight())
                {
                    %><%= rsr[i]%>&nbsp;<%
                }
                i ++;
            }
            %><br><%
        }
        %>
        &nbsp;&nbsp;&nbsp;&nbsp;<%= eq.getNowNewLineResolution()%>
        <br>
        </td>
    </tr>
</table>